package com.itheima.day04;

/*
案例4: 查找数组中元素的位置:
 */

import java.util.Scanner;

public class TestClassCase04 {
    public static void main(String[] args) {


        Scanner sc=new Scanner(System.in);
        int[] num={1,2,5,3,7,12};
        int index=-1;

        System.out.println("请输入你要查找的数:");
        int search=sc.nextInt();

        for (int i = 0; i < num.length; i++) {

            if (search == num[i]) {
                index=i;
                break;
            }
        }
        System.out.println("你查找的数位置:"+index);
    }
}
